import React, {FC, useContext} from 'react';
import "./index.less";
import {FrontSiteAbout} from "@/services";
import {HxConfigContext} from "@/layouts/HxConfigContext";
import {FormattedMessage} from "umi";
import {correspVal} from "@/utils/biz";
import {LinkOutlined} from "@ant-design/icons";

interface FriendLinksContainerProps {
}

/**
 * 友情链接 页面
 */
const FriendLinksContainer: FC<FriendLinksContainerProps> = (props) => {
  const {siteInfo, isZhCN} = useContext(HxConfigContext);
  if (!siteInfo?.linkAddress || siteInfo?.linkAddress.length === 0) {
    return null;
  }
  //console.log("友情链接: ", siteInfo?.linkAddress)
  return (
    <div className={"hxiw-page-friendship-links-container"}>
      <span><FormattedMessage id="about.friendship"/></span>
      <ul className="hxiw-page-friendship-links">
        {
          siteInfo?.linkAddress?.map((abtlink, index) => {

            return (
              <li key={index}>
                <a href={abtlink.url} target={"_blank"}>
                  <LinkOutlined /> {correspVal(isZhCN, abtlink?.nameCn, abtlink?.nameEn)}
                </a>
              </li>
            );
          })
        }
      </ul>
    </div>
  );
};

export default FriendLinksContainer;
